package com.oa.co.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.oa.co.mapper.PrinterMapper;
import com.oa.co.pojo.Printer;
import com.oa.co.service.PrinterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("printerService")
public class PrinterServiceImpl implements PrinterService {
    @Autowired
    private PrinterMapper printerMapper;

    @Override
    public PageInfo<Printer> getPageData(Integer page, Integer limit, Integer printer_id) {
        Printer printer = new Printer();
        printer.setPrinter_id(printer_id);

        PageHelper.startPage(page,limit);

        List<Printer> printers = printerMapper.selectPrinter(printer);

        PageInfo<Printer> printerPageInfo = new PageInfo<>(printers);


        return printerPageInfo;
    }
}
